/* =========================================================================

DESCRIPTION
   cae_app

Copyright (c) 2015 by  USTC iFLYTEK, Co,LTD.  All Rights Reserved.
============================================================================ */

/* =========================================================================

                             REVISION

when            who              why
--------        ---------        -------------------------------------------
2015/12/22     leqi               Created.
============================================================================ */

/* ------------------------------------------------------------------------
** Includes
** ------------------------------------------------------------------------ */
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <sys/stat.h>
#include <pthread.h>
#include<stdio.h>
#include<stdlib.h>
#include <alsa/asoundlib.h>
#include<sys/types.h>
#include<time.h>

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/i2c-dev.h>
#include <linux/i2c.h>
#include <linux/input.h>
#include <assert.h>
#include <string.h>

#include "iic_test.h"

/* ------------------------------------------------------------------------
** Macros
** ------------------------------------------------------------------------ */
#define UART_DEVICE       "/dev/ttyS2"
#define WAKE_UP_DEVICE    "/dev/sunxi-wakeup"

// define default sent cmd
#define UART_SENT_CMD      "UART_TEST\n"
#define WAKEUP_SENT_CMD    "WAKEUP_TEST\n"
#define MIC_SENT_CMD       "MIC_TEST\n"
#define I2C_I2S_SENT_CMD   "I2C_I2S_TEST\n"

// define default rec cmd
#define UART_REC_CMD 	  "UART_TEST"
#define MIC_REC_CMD_O     "MIC_TEST_OK"
#define MIC_REC_CMD_F     "MIC_TEST_WRONG"


#define  TIME_500MS       500000

int main(int argc, char* argv[])
{	
    unsigned int fd = open_i2c_device("/dev/i2c-1");
	ioctl(fd,I2C_TENBIT,0);
	ioctl(fd,I2C_SLAVE,0X47);
	int n=1;	
	if(argc==3)
	{
		n=atoi(argv[2]);
	}
	bool cmd_judge=true;
	if(argc>1)
	{
		cmd_judge=chos_cmd(argv[1], n, fd);
	}
	if(cmd_judge==0)
	{
		printf("COMMEND ERROR\n");
	}
	close_i2c_device(fd);
    return 0;
}
